package com.example.demo.Service.Impl;

import com.example.demo.Service.BookService;
import com.example.demo.mapper.BookMapper;
import com.example.demo.mapper.BorrowMapper;
import com.example.demo.model.Book;
import com.example.demo.model.Borrow;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class BookServiceImpl implements BookService {
    @Autowired
    BookMapper bookMapper;


    @Override
    public Integer addBook(Book newbook) {
        Integer result = bookMapper.addBook(newbook);
        return result;
    }

    @Override
    public Integer deleteBook(Integer book_id) {
        Integer result = bookMapper.deleteBook(book_id);
        return result;
    }

    @Override
    public Integer modifyBook(Book book) {
        Integer result = bookMapper.modifyBook(book);
        return result;
    }

    @Override
    public List<Book> getBookList() {
        List<Book> result = bookMapper.getBookList();
        return result;
    }

    @Override
    public List<Map<String, Integer>> getBookCountByCategory() {
        List<Map<String, Integer>> result = bookMapper.getBookCountByCategory();
        return result;
    }
}
